home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #3 / Amiga Plus CD - 2002 - No. 03.iso / AmiSoft / Dev / Gui / Cit.lha / CIT / Demo / GetFontTest.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2003-02-15  |  1.6 KB  |  86 lines

  1. #include <CITGroup.h>
  2. #include <CITButton.h>
  3. #include <CITGetFont.h>
  4.  
  5. CITApp Application;
  6.  
  7. CITWorkbench DemoScreen;
  8. CITWindow    DemoWindow;
  9. CITVGroup    winGroup;
  10. CITGetFont   fontReq;
  11. CITButton    quitButton;
  12.  
  13. void CloseEvent();
  14. void FontReqEvent(ULONG ID,ULONG eventFlag);
  15. void QuitEvent(ULONG ID,ULONG eventFlag);
  16.  
  17. int main(void)
  18. {
  19.   BOOL Error=FALSE;
  20.  
  21.   DemoScreen.InsObject(DemoWindow,Error);
  22.     DemoWindow.Position(WPOS_CENTERSCREEN);
  23.     DemoWindow.CloseGadget();
  24.     DemoWindow.DragBar();
  25.     DemoWindow.SizeGadget();
  26.     DemoWindow.DepthGadget();
  27.     DemoWindow.IconifyGadget();
  28.     DemoWindow.Activate();
  29.     DemoWindow.Caption("CITGetFont Test");
  30.     DemoWindow.CloseEventHandler(CloseEvent);
  31.     DemoWindow.InsObject(winGroup,Error);
  32.       winGroup.SpaceOuter();
  33.       winGroup.InsObject(fontReq,Error);
  34.         fontReq.MaxHeight(15);
  35.         fontReq.LabelText("Font:");
  36.         fontReq.RequesterTitleText("Select Font..");
  37.         fontReq.EventHandler(FontReqEvent);
  38.       winGroup.InsObject(quitButton,Error);
  39.         quitButton.Text("Quit");
  40.         quitButton.MaxHeight(30);
  41.         quitButton.EventHandler(QuitEvent);
  42.  
  43.   Application.InsObject(DemoScreen,Error);
  44.  
  45.   // Ok?
  46.   if( Error )
  47.     return 10;
  48.  
  49.   Application.Run();
  50.  
  51.   return 0;
  52. }
  53.  
  54. void FontReqEvent(ULONG ID,ULONG eventFlag)
  55. {
  56.   fontReq.RequestFont();
  57. }
  58.  
  59. void QuitEvent(ULONG ID,ULONG eventFlag)
  60. {
  61.   Application.Stop();
  62. }
  63.  
  64.  
  65. int repeatCount = 0;
  66.  
  67. void CloseEvent()
  68. {
  69.   int mode;
  70.  
  71.   repeatCount++;
  72.  
  73.   switch( repeatCount )
  74.   {
  75.     case 1:
  76.       fontReq.DrawMode(5);
  77.       break;
  78.     case 2:
  79.       mode = fontReq.DrawMode();
  80.       break;
  81.     default:
  82.       Application.Stop();
  83.     break;
  84.   }
  85. }
  86.